package com.pan.admin.quartz.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 *  Redis-ping
 *
 *  @author Pan
 */
@Configuration
@EnableScheduling
@Slf4j
public class RedisConnectTask {

    @Resource
    private StringRedisTemplate dupShowMasterRedisTemplate;

    @Scheduled(fixedRate = 10000)
    private void configureTasks() {
        dupShowMasterRedisTemplate.execute((RedisCallback<String>) connection -> connection.ping());
    }

}
